package top.kangyaocoding.ecommerce.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import top.kangyaocoding.ecommerce.po.UserBuyCount;

import java.util.List;

/**
 * 描述:
 *
 * @author K·Herbert
 * @since 2025-02-16 下午3:58
 */
@Mapper
public interface IUserBuyCountDao {
    @Select("SELECT * FROM user_buy_count")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "buyCount", column = "buy_count"),
            @Result(property = "userId", column = "user_id")
    })
    List<UserBuyCount> findAll();

    @Select("SELECT * FROM user_buy_count ORDER BY buy_count DESC LIMIT 50")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "buyCount", column = "buy_count"),
            @Result(property = "userId", column = "user_id")
    })
    List<UserBuyCount> findTop50();
}
